<?php
/**
 * XHTML document, DTD and XML declaration.
 *
 * @package Core
 * @subpackage Document
 * 
 */
class Lead_Controller_Response_Document_DTD extends Lead_Controller_Response_Document_Part 
{

	
	/**
	 * Supported DTD types
	 *
	 * @var array
	 */
	protected $dtds = array    
	(
	0 => "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n",
	1 => "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
	);
	
	/**
	 * Renders DTD. The type comes from document object.
	 *
	 * @return unknown
	 */
	public function render()
	{
		$output = '';
		
		$type = $this->document->type();
		
		if($type AND (!$this->document->isIE() OR !$this->document->fixIE()))
			$output .= "<?xml version=\"1.0\" encoding=\"" . $this->document->contentType() . "\"?>\n";
				

		$output .= $this->dtds[$type];
		
		return $output;
		
	}
	
	
	
	
	
}
?>